package com.trans.service.impl;

import com.trans.dao.LogDao;
import com.trans.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogDao logDao;

    @Transactional(rollbackFor = {IOException.class},isolation = Isolation.READ_COMMITTED,propagation = Propagation.REQUIRES_NEW)
    public void writeLog(String fromName, String toName, Double money) {
        String info = fromName + "向"+toName+"转账"+money+"元";
        logDao.writeLog(info);
    }
}
